package com.njmt.cloud.msprovder.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njmt.cloud.msprovder.mapper.UserMapper;
import com.njmt.cloud.msprovder.service.UserService;
import com.njwt.cloud.mscommon.pojo.bo.UserBo;
import com.njwt.cloud.mscommon.pojo.vo.UserVo;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author <a href="mailto:xingxiaofeng@gtmap.cn">xingxiaofeng</a>
 * @date 2022-06-21
 * @desc UserServiceImpl
 */
@Service("userService")
public class UserServiceImpl extends ServiceImpl<UserMapper,UserBo> implements UserService {

    @Override
    public UserBo loadUserByUserName(String username) {
        return baseMapper.findByUserName(username);
    }

    public UserBo loadUserById(String userid){
        return baseMapper.findByUserId(userid) ;
    }
    @Override
    public List<UserVo> queryUserList(Map map){
        Integer currentPage = map.get("currentPage") == null ? 1 : (Integer)map.get("currentPage");
        Integer pageSize = map.get("pageSize") == null ? 10 :  (Integer)map.get("pageSize");
        Page<UserVo> page=new Page<>(currentPage,pageSize);
        return baseMapper.findUserList(page, map);
    }
   
}
